package com.trg.generaltool.util.async;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * ClassName: AsyncMain
 * Description:
 * date: 2021-03-24 16:09
 *
 * @author tangrg
 * @since JDK 1.8
 */
@Component
@Slf4j
public class AsyncMain {

    @Autowired
    AsyncTest asyncTest;

    public void test() {
        for (int i = 0; i < 100; i++) {
            try {
                Thread.sleep(1000);
                asyncTest.async();
                log.info(Thread.currentThread().getName() + ":" + i);

            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }

}
